{% extends 'base.html' %}
{% load staticfiles %}
{% block title %}琢越网{% endblock %}

{% block custom_js %}<script src="{% static 'js/jquery-3.3.1.min.js' %}"></script>{% endblock %}
{% block custom_css %}<link rel="stylesheet" href="{% static 'css/mystyle.css' %}">{% endblock %}

{% block content %}
    <div class="row clearfix main-bk">
        <br></br>
        <div class="col-md-8 column white-bk col-block col-column"style="margin-left:250px"><!注册框>
            <form class="form-horizontal" method="post" action="{% url 'register' %}" role="form" >
            <fieldset>
            <legend style="line-height:250%;color:black;font-weight:900;text-align:center;">注&nbsp;册</legend>
                <div class="form-group" >
                    <label for="e-mail" class="col-sm-offset-2 col-sm-2 control-label">邮&nbsp;&nbsp;箱</label>
                    <div class="col-sm-5">
                        <input class="form-control" name="email" id="e-mail" type="email" />
                    </div>
                    <p id="e-mailInfo"></p>
                </div>
                <div class="form-group">
                     <label for="password" class="col-sm-offset-2 col-sm-2 control-label">密&nbsp;&nbsp;码</label>
                    <div class="col-sm-5">
                        <input class="form-control" name="password1" id="password" type="password" />
                    </div>
                </div>
                <div class="form-group">
                     <label for="password2" class="col-sm-offset-2 col-sm-2 control-label">确认密码</label>
                    <div class="col-sm-5">
                        <input class="form-control" name="password2" id="password2" type="password" />
                    </div>
                </div>
                <div class="form-group marb8 captcha1" >
                    <label for="get-verify" class="col-sm-offset-2 col-sm-2 control-label">验证码</label>
                    {{ register_form.captcha }}
                </div>
                <div class="error btns login-form-tips" id="jsLoginTips">
                    {% for key,error in register_form.errors.items %}
                        {{ error }}
                    {% endfor %}
                    {{ msg }}
                </div>
                <div class="col-sm-offset-5 col-sm-20">
                         <button onclick="validRegister()" type="submit" class="btn btn-warning btn-default">注册</button>
                    </div>
                </div>
            </fieldset>
            {% csrf_token %}
            </form>
        </div>
    </div>
{% endblock %}
{% block custom_script %}
    <script>
// 校验注册信息
      function validRegister(){
        var sPassword = document.getElementById('password');
		var sPassword2 = document.getElementById('password2');
		var sEmail = document.getElementById('e-mail');
		var sGet-verify = document.getElementById('get-verify');
        if ( sEmail.value == ''){
			//document.getElementById("e-mailInfo").innerHTML = "请输入邮箱";
			alert("请输入邮箱!");  return false ;
        }
		if ( sPassword.value == ''){
			alert("请输入密码!");  return false ;
        }
		if ( sPassword2.value == ''){
			alert("请再次输入密码!");   return false ;
        }
		if ( sGet-verify.value == ''){
			alert("请输入验证码!");  return false ;
		}
       }
</script>
{% endblock %}